module MuIDE
  class HelpTree < Wx::TreeCtrl
    attr_accessor :items,:view
    def initialize(view,*args)
      super *args
      @view = view
      @items = {}
      @root = add_root("Help", 0)
      @items[:about]=append_item(@root,'About',0)
      @items[:extensions]=append_item(@root,'Extensions',0)
      append_item(@items[:extensions],'RubyEditor',0)
      append_item(@items[:extensions],'YamlEditor',0)
      append_item(@items[:extensions],'ObjectViewer',0)
      append_item(@items[:extensions],'ProjectManager',0)
      append_item(@items[:extensions],'Mu_ServerInterface',0)
      append_item(@items[:extensions],'InterLibraryFunctions',0)
#       append_item(@items[:extensions],'ObjectViewer',0)
      @items[:rubyMU]=append_item(@root,'Ruby_Mu-Bindings',0)
      evt_tree_item_activated(self.get_id) { | evt |
        item = get_item_text(evt.get_item)
#         p item;exit
        case item
          when /Extensions/
            set(item)
          when /Ruby_Mu-Bindings/
            set(item)
          when /About/
            set(item)
          else
            set(item)
        end 
      }
      expand @root
    end
    def set(item)
      view.set_page File::open("help/#{item}.html").readlines.join
    end
  end
  class Output < Wx::TextCtrl
    def initialize(*args)
      super *args
set_default_style Wx::TextAttr::new(Wx::Colour::new("GREY"),Wx::BLACK,Wx::Font.new(10, Wx::MODERN, -1,-1, false))
    end
  end
  class Input < Wx::TextCtrl
    def initialize(*args)
      super *args
set_default_style Wx::TextAttr::new(Wx::BLACK,Wx::WHITE,Wx::Font.new(10, Wx::MODERN, -1,-1, false))
    end
  end
  class ProjTree < Wx::TreeCtrl
    attr_accessor :root,:items
    def initialize(*args)
      super *args
      @items={}
      img_list = Wx::ImageList.new(16, 16, true, 2)
      img_list.add( Wx::ArtProvider::get_bitmap( Wx::ART_FOLDER, 
                                               Wx::ART_OTHER, 
                                               Wx::Size.new(16, 16) ) )
      img_list.add( Wx::ArtProvider::get_bitmap( Wx::ART_NORMAL_FILE, 
                                               Wx::ART_OTHER, 
                                               Wx::Size.new(16, 16) ) )
      set_image_list(img_list)
      @root = add_root("Projects", 0)
    end
  
  end
  class Eval < Wx::TextCtrl
    def initialize(*args)
      super *args
    end
  end
end